package Solution;

import java.util.Scanner;

public class Solution {
    //12. Integer to Roman整数转罗马数
public static String intToRoman(int num){
    int[] A={1000,900,500,400,100,90,50,40,10,9,5,4,1};
    String[] B={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
    StringBuilder b=new StringBuilder();
    for(int i=0;i<A.length;i++){
        while(num>=A[i]){
            b.append(B[i]);
            num-=A[i];
        }
    }
    return b.toString();
}

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        System.out.println(num);
        int a=num;
        System.out.println(intToRoman(a));
    }
}
